﻿namespace _030泛型_部分类_枚举_结构体_4_LINQ委托
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Action只能引用没有返回值的函数
            Action<string> a1 = Say;
            a1.Invoke("chengzi");
            Action<int> a2 = Mul;
            a2.Invoke(52);


            //有返回值要引用Fuc 两个int形参  一个int返回值类型
            Func<int, int, int> fun1 = Add;
            Func<double, double, double> fun2 = Add;
            Console.WriteLine(fun1(3, 3));

            //lamda表达式
            Func<int, int, int> cal = ( a, b) =>
            {
                return a + b;
            };


        }

        //参数委托

        static void Say(string str)
        {
            Console.WriteLine($"wo xihuan {str}");
        }

        static void Mul(int x)
        {
            Console.WriteLine(x * 100);
        }

        static int Add(int a, int b)
        {

            return a + b;
        }

        static double Add(double a, double b)
        {
            return a + b;
        }




    }


}
